public class NumberNine {
    public static void main(String[] args) {

        int i = 0;
        int paragon = 0;//记录数字
        int amount = 0;

        for (i = 1; i <= 100; i++) {
            paragon = i;

            while (paragon % 10 == 9) {
                paragon /= 10;
                amount++;
            }
        }

        System.out.printf("数字“9”有%d个。\n", amount);
    }
}
